package cn.edu.nju.ws.sview.views.listener;

import java.util.Timer;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
/**
 * 
 * 自Web应用程序启动后，就使用了内部定时器，每周周末晚上10点定时清空已临时的datamember
 * 
 * @author ssgong
 *
 */
public class DMClearListener implements ServletContextListener{
    private Timer timer = null;
    
    public void contextInitialized(ServletContextEvent event){
    	timer  = new Timer(true);
    	
    	timer.schedule(new DMClearTask(),0,2*60*60*1000);
    	
    }
    
    public void contextDestroyed(ServletContextEvent event){
    	timer.cancel();
    }
}
